<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>	
<%@ page import="jt.classic.system.role.IRole"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="jt.classic.system.context.ISystemContext"%>
<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="jt.classic.system.wordbook.XWordbook" %>
<%@ page import="jt.classic.system.wordbook.XWordbookMain" %>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<%
  response.setHeader("Pragma","No-cache");//HTTP 1.1 
  response.setHeader("Cache-Control","no-cache");//HTTP 1.0 
  response.setHeader("Expires","0");//防止被proxy 

  String context = jt.classic.system.context.ISystemContext.getContextPath();
  
  String serverPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
  
  if (ISystemContext.invalidSesstion(request)) {
	  out.println("<script language='javascript'>");
	  //out.println("alert(\"当前会话无效,请重新登录\");");
	  out.println("top.location = '" + (context.equals("") ? "/" : context) + "';");
	  out.println("</script>");
  }else{
  IUser user = ISystemContext.getSessionUser(request);
  String ssosessionkey = ISystemContext.getSSOSessionKey(user);
  
  List roleList = user.iroles();
  
  XWordbookMain wbmain = XWordbookMain.getInstance();
  List headParamList = wbmain.getWord("jspparameters");
%>
<script>
	var context = "<%=context%>";
	var serverPath = "<%=serverPath%>";
	var SSOSESSIONKEY = "<%=ssosessionkey%>";
	var userId = "<%=user.id()%>";
	var userName = "<%=user.iname()%>";
	var groupId = "<%=(user.igroup() != null ? user.igroup().id() : "")%>";
	var groupName = "<%=(user.igroup() != null ? user.igroup().iname() : "")%>";
	var userFlag = <%=user.iflag()%>;
	var IP = "<%=request.getRemoteAddr()%>";

	if(document.all){
	     setTimeout("CollectGarbage()",1000);
	}
</script>

<script language="javascript"
	src="<%=context%>/resources/common/js/hashmap.js"></script>
<link
	href="<%=context %>/site/ui/lib/ligerUI/skins/Aqua/css/ligerui-all.css"
	rel="stylesheet" type="text/css" />
<link href="<%=context %>/site/ui/lib/ligerUI/skins/Gray/css/all.css"
	rel="stylesheet" type="text/css" />
<link
	href="<%=context %>/site/ui/lib/ligerUI/skins/ligerui-icons.css"
	rel="stylesheet" type="text/css" />	
<script src="<%=context %>/site/ui/lib/jquery/jquery-1.5.2.min.js"
	type="text/javascript"></script>
<script src="<%=context %>/site/ui/lib/ligerUI/js/core/base.js"
	type="text/javascript"></script>	
<script src="<%=context %>/site/ui/lib/json2.js" type="text/javascript"></script>			
<script>
    var roles = new HashMap(); 
    <%
    	if(roleList != null && !roleList.isEmpty()){
    		for(int i = 0 ; i< roleList.size(); i++){
    			IRole role = (IRole)roleList.get(i);
    %>
    roles.put('<%=role.ikey()%>', '<%=role.iname()%>');
    <%
    		}
    	}
    %>
    
    <%
        if(headParamList != null && !headParamList.isEmpty()){
        	for(int i=0;i<headParamList.size();i++){
        		XWordbook wb = (XWordbook)headParamList.get(i);
        		String paramName = StringTool.checkString(wb.getID());
        		String paramValue = StringTool.checkString(wb.getName());
        		if(!paramName.equals("")){
    %>
    var <%=paramName%> = '<%=paramValue%>';
    <%
        	
        		}
        	}	
        }
    %>
</script>
<%}%>